<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>数量值{{ shengyu }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: this.gaoliang === 'all' }"
          @click="gl('all')"
          href="javascript:;"
          >全部</a
        >
      </li>
      <li>
        <a
          href="javascript:;"
          :class="{ selected: this.gaoliang === 'active' }"
          @click="gl('active')"
          >未完成</a
        >
      </li>
      <li>
        <a
          href="javascript:;"
          :class="{ selected: this.gaoliang === 'complete' }"
          @click="gl('complete')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="qingchu" v-show="qing">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  data() {
    return {
      gaoliang: "all",
    };
  },
  props: ["obj"],
  methods: {
    qingchu() {
      this.$emit("qingchu");
    },
    gl(a) {
      // console.log(a);
      this.gaoliang = a;
      this.$emit("dibu", a);
    },
  },
  computed: {
    shengyu() {
      return this.obj.filter((item) => !item.isDone).length;
    },
    qing() {
      return this.obj.some((item) => item.isDone);
    },
  },
};
</script>
